using Microsoft.AspNetCore.Mvc;
using Sheep_Breeding.Infeartructure;
using Sheep_Breeding.Domain.production_b;
using System.Linq;
using System.Threading.Tasks;

namespace Sheep_Breeding.Write.Api.Controllers
{
    [ApiController]
    [Route("api/[controller]/[action]")]
    public class SheepTypeController : ControllerBase
    {
        private readonly EFDbContext db;
        public SheepTypeController(EFDbContext db)
        {
            this.db = db;
        }

        /// <summary>
        /// 获取羊只类型下拉列表
        /// </summary>
        [HttpGet]
        public async Task<IActionResult> GetSheepTypeList()
        {
            var list = db.SheepTypes.Select(x => new { x.Id, x.TypeName }).ToList();
            return Ok(new { code = 200, msg = "success", data = list });
        }
    }
} 